/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mybean;

import java.text.DecimalFormat;

/**
 *
 * @author Phu
 */
public class BookInCart {

    private Book book;
    private int quantity;
    private float totalCash;
    private DecimalFormat df = new DecimalFormat("###.##");

    public BookInCart(Book book, int quantity) {
        super();
        this.book = book;
        this.quantity = quantity;
        this.totalCash = Float.parseFloat(df.format(book.price * quantity));
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public float getTotalCash() {
        return totalCash;
    }

    public void setTotalCash(float totalCash) {
        this.totalCash = totalCash;
    }

    @Override
    public String toString() {
        return "BookInCart{" + "book=" + book.getBookID() + ", quantity=" + quantity + ", totalCash=" + totalCash + '}';
    }            
}
